<template>
	<view class="box">
		<u-navbar title="珺璟" :autoBack="true" :placeholder="true" leftIconColor="#ffffff" :titleStyle="{color: '#ffffff'}" bgColor="#e60000" class="navBarHeight" @click="leftClick">
		</u-navbar>
		<web-view :src="webUrl" v-if="webUrl" class="web" :webview-styles="handleTop()"></web-view>
	</view>
</template>

<script>
	import config from '@/common/config/config.js'
	import { mapState } from 'vuex'
	export default {
		data() {
			return {
				webUrl: '',
				wTop: 0
			};
		},
		computed: {
			...mapState(['ycToken'])
		},
		onLoad(e) {
			let type = e.type
			if(type === 'ticket'){
				this.webUrl = config.env.ycWebTicket + '&token=' + this.ycToken
			}else if(type === 'record'){
				this.webUrl = config.env.ycWebRecord + '&token=' + this.ycToken
			}else{
				this.webUrl = config.env.ycWeb + '&token=' + this.ycToken
			}
		},
		onUnload() {
			// 返回首页
			uni.$emit('backIndex')
		},
		methods: {
			handleTop() {
				// #ifdef APP-PLUS
				// 获取系统信息
				const systemInfo = uni.getSystemInfoSync();
				// 设备的屏幕高度（单位px）
				const screenHeight = systemInfo.windowHeight;
				// 状态栏的高度（单位px）
				const statusBarHeight = systemInfo.statusBarHeight;
				let top = 44 + statusBarHeight
				let height = screenHeight - statusBarHeight - 44
				return {top: top+'px', height: height + 'px'}
				// #endif
			}
		}
	}
</script>

<style lang="scss" scoped>
.box {
	.web {
		/* #ifdef H5 */
		top: 88rpx;
		/* #endif */
	}
}
</style>
